BIN=process
CC=gcc
SRC=$(wildcard *.c)
OBJ=$(SRC:.c=.o)
LFLAGS=-o
CFLAGS=-c -std=c99
RM=rm -f

$(BIN):$(OBJ)
	@$(CC) $(LFLAGS) $@ $^
	@echo "链接$^ 成为 $@"
%.o:%.c
	@$(CC) $(CFLAGS) $<
	@echo "编译$< 成为 $@"

.PHONY:clean
clean:
	@$(RM) $(BIN) $(OBJ)
	@echo "清理完成"

.PHONY:printf
printf:
	@echo $(SRC)
	@echo "-----------------------"
	@echo $(OBJ)



#BIN=code1
#CC=gcc
#SRC=code1.c
#FLAGS=-o
#RM=rm -f
#
#$(BIN):$(SRC)
#	$(CC) $(FLAGS) $@ $^
#.PHONY:clean
#clean:
#	$(RM) $(BIN)


#BIN=code
#
#.PHONY:printf
#printf:
#	@echo $(BIN)

#code1:code1.o
#	@gcc -o code1 code1.o
#code1.o:code1.c
#	@gcc -c code1.c
#.PHONY:clean
#clean:
#	@rm -f code1 code1.o


#code1:code1.c
#	gcc -o code1 code1.c
#.PHONY:clean
#clean:
#	rm -f code1
